package com.grape.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.grape.dao.base.StandardRepository;
import com.grape.domain.base.Standard;
import com.grape.service.base.StandardService;

@Service
public class StandardServiceImpl implements StandardService{

	@Autowired
	private StandardRepository sr;
	
	@Override
	public void save(Standard standard) {
		sr.save(standard);
	}

	@Override
	public Page<Standard> findAll(Pageable pageable) {
		return sr.findAll(pageable);
	}

	@Override
	public List<Standard> findAll() {
		return sr.findAll();
	}

	@Override
	public void delBatch(String ids) {
		
		String idss = ids.substring(2, ids.length());
		String[] split = idss.split(",");
		
		for (String str : split) {
			sr.delete(Integer.parseInt(str));
		}
	}


}
